package org.example;

public class Player implements Observer {
    public String name;

    public Player(String name) {
        this.name = name;
    }

    @Override
    public void help() {
        System.out.println("盟友前来支援:" + this.name);
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public void setName(String name) {
        this.name=name;
    }

    @Override
    public void beAttacked(Subject acc) {
        System.out.println(this.name+"被攻击了");
        acc.notifyObservers(name);
    }
}
